package com.sporch.controller;

import com.czy.annotation.RequiredPermission;
import com.czy.model.UserInfo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Controller {
    @Value("${server.port}")
    String port;

    @RequiredPermission("admin2")
    @RequestMapping("/hi")
    public String home(@RequestParam String name){
        return "hi"+name+",i am from port:"+port;
    }

    @RequestMapping("/hehe")
    public String remoteMethod(String name){
        return "远程调用成功";
    }

    @RequestMapping("/hehe2")
    public String remoteMethod2(@RequestBody UserInfo userInfo){
        return "远程调用成功"+userInfo.getUserName();
    }
}
